﻿using System;
using Socium.Domain.Collections;

namespace Socium.Domain.Persons {
	[Serializable]
	public class Person {
		readonly Guid _id;

		public Person() {
			_id = Guid.NewGuid();
		}

		public string GivenName { get; set; }
		public string FamilyName { get; set; }
		public string Patronymic { get; set; }

		public Gender Gender { get; set; }

		public string FullName { get; set; }

		public Guid Id {
			get { return _id; }
		}

		public override string ToString() {
			if (!string.IsNullOrEmpty(FullName)) {
				return FullName;
			}

			var values = new[] {GivenName, Patronymic, FamilyName};
			var result = values.Join(" ");
			return string.IsNullOrEmpty(result) ? "Person" : result;
		}
	}
}